Skip to main content

All Questions

Tagged with
8votes
1answer
239views

bash or ksh 'vi' mode - How to jump to end of history (most recent command)?

I am a long time ksh user, and use bash under duress - both in 'vi' editing mode. One thing that has always niggled - after searching back through history for a command (.e.g <Esc>/needle), how ...
Annihilannic's user avatar
-1votes
1answer
62views

"history -0" works in ksh, why doesn't "history -0" work in zsh?

Why does ksh history -0 (last command which is the history command itself) work, yet zsh it fails (only history -1 avail on my zsh). I tried zsh -f to use default options and it still fails. I'm ...
atod's user avatar
0votes
1answer
44views

ksh: how to capture the current invoked command and arguments?

How do I obtain a variable with the current command and arguments? I would like to use escape code to print this in an Xterm title bar. I see Terminal.app on MacOS is determining the name of the ...
atod's user avatar
3votes
1answer
202views

zsh: History is skipping commands and integers+, how to correct this?

Does anyone know what's occurring with zsh below and how to get the same behavior I show with ksh and bash? I'm noticing zsh on MacOS v13.7 is skipping even commands numbers in its history output, ...
atod's user avatar
0votes
0answers
33views

Can't use combination of parentheses and variables in scripts [duplicate]

I have problems with replacing parentheses in combination with variables, in ssh. For instance, replacing (hello123blablabla) with (hello). So, it replaces all together, and parentheses as well, at ...
armagedescu's user avatar
3votes
1answer
93views

How does my function break `functions`?

I wrote a ksh function for git checkout (I've removed some irrelevant proprietary components for the sake of the public question, if you're wondering why it's useful to me): # Checkout quicker ...
Yehuda's user avatar
-2votes
1answer
244views

"for" loop is not executing on the remote server using SSH

The below "for" loop works locally on the same server. But when triggered through "ssh" protocol on remote servers, the output is not received. Please, can anyone suggest how to ...
ShyamNarayan's user avatar
0votes
2answers
795views

Bash and other shells $(...) remove the ending newline character [duplicate]

Why the shell structure $(...) removes the ending newline character? #!/bin/bash S='a b ' printf '%i [%s]\n' "${#S}" "$S" T=$(printf '%s' "$S") printf '%i [%s]\n' "...
Olivier Pirson's user avatar
2votes
1answer
465views

if var='value' then in Zsh: Is it really a valid syntax without semicolon?

The following code works on Zsh 5.8 that I tried, despite the missing semicolon. But is it really a valid Zsh syntax? #!/bin/zsh if var='value' then echo 'then' fi Without an assignation that ...
Olivier Pirson's user avatar
0votes
1answer
492views

Switch user using EOF does not work su - ${instance} <<'EOF'

I am running a ksh script from root where I switch (su) to different users and execute the commands. But, some reason EOF does not. Here is part of my code. This part of the code does not work su - $...
user3590915's user avatar
-3votes
1answer
459views

Awk variable passing error

Below works fine: awk '{print $1,$2,$3,$4,$5,$6,$7,$8,$57,$9,$55,$10,$11,$12,$56,$13,$53,$14,$15,$16,$17,$18,$19,$20,$21,$22,$23,$24,$25,$26,$27,$28,$29,$30,$31,$32,$33,$34,$35,$36,$37,$38,$39,$40,$41,...
Ami's user avatar
0votes
1answer
268views

how to check for specific string in a file named abc.txt and write that missing string to another file (xyz.txt) using a shell script?

For example, generally I need to check for 5 strings. (Note : the strings are in file format .txt) file1.txt file2.txt file3.txt file4.txt file5.txt but there are 3 strings in abc.txt file1.txt ...
Jayashree's user avatar
1vote
1answer
475views

Read content of file in ksh and split it by ','

My file.txt contains the following content:- ./raw_input/0009/img.raw,./raw_input/0009/calib.raw
Bhawneet Singh's user avatar
-1votes
1answer
577views

One master ksh file to call 2 ksh script files [duplicate]

I have 2 ksh (korn shell script) : file1.ksh and file2.ksh; and I want to have a master file ksh script that will call the 2 files; what's the code I have to put in my master file? Thanks
ssaf's user avatar
0votes
3answers
1kviews

Script to keep the latest 5 files and rest will be moved to other destination

Source path: /var/log/ Here I have 4 folders named ad1nrld,ad2nrld,icp1rmnrl,icp2rmnrl I can move all the files to the other destination named /home/spsy/logs_bkp. But I want to keep latest 5 files in ...
Nainita's user avatar
  • 2,962

153050per page
close